import request from "@/utils/request";

// 商品列表
export function getShopGoods(params, page = 1, pageSize = 10) {
  return request({
    url: `/shopGoods/list?pageNo=${page}&pageSize=${pageSize}`,
    method: "post",
    data: params,
  });
}

// 获取商品详情
export function getShopGoodDetail(id) {
  return request({
    url: `/shopGoods/getDetailById?theId=${id}`,
    method: "post",
  });
}

// 新增或者编辑商品
export function addOrEditShopGood(data) {
  return request({
    url: "/shopGoods/saveUpdate",
    method: "post",
    data,
  });
}

// 删除商品
export function deleteShopGood(id) {
  return request({
    url: `/shopGoods/deleteByStatus?theId=${id}`,
    method: "post",
  });
}

// 获取商品分类列表
export function getProductCategories(params, page = 1, pageSize = 10) {
  return request({
    url: `/shopGoodsType/list?pageNo=${page}&pageSize=${pageSize}`,
    method: "post",
    data: params,
  });
}

// 获取商品分类详情
export function getProductCategoryDetail(id) {
  return request({
    url: `/shopGoodsType/getDetailById?theId=${id}`,
    method: "post",
  });
}

// 新增或者编辑商品分类
export function addOrEditProductCategory(data) {
  return request({
    url: "/shopGoodsType/saveUpdate",
    method: "post",
    data,
  });
}

// 删除商品分类
export function deleteProductCategory(id) {
  return request({
    url: `/shopGoodsType/deleteByStatus?theId=${id}`,
    method: "post",
  });
}
